package sivin.uikit.extend

import android.view.View

fun View.setOnSafeClickListener(interval: Long = 500L, onSafeClick: (View) -> Unit) {
    var lastClickTime = 0L
    this.setOnClickListener {
        val currentTime = System.currentTimeMillis()
        if (currentTime - lastClickTime >= interval) {
            lastClickTime = currentTime
            onSafeClick(it)
        }
    }
}